package cn.chenfyuan.demoapplication.service.impl;

import java.io.Serializable;
import java.util.List;

import cn.chenfyuan.demoapplication.entity.Role;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.baomidou.mybatisplus.plugins.Page;

import cn.chenfyuan.demoapplication.mapper.RoleMapper;
import cn.chenfyuan.demoapplication.service.RoleService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author linweijian
 * @since 2018-08-31
 */
@Service
@Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED)
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {
	
	@Autowired
	private RoleMapper roleMapper;

	@Override
	public Page<Role> selectPage(Page<Role> page, Role vo) {
		page.setRecords(roleMapper.selectPage(page, vo));
		return page;
	}

	@Override
	public List<String> getRolesByAccount(String account) {
		return roleMapper.getRolesByAccount(account);
	}

	@Override
	public Role selectById(Serializable id) {
		return super.selectById(id);
	}

	@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
	@Override
	public boolean insert(Role entity) {
		return super.insert(entity);
	}

	@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
	@Override
	public boolean deleteById(Serializable id) {
		return super.deleteById(id);
	}

	@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
	@Override
	public boolean updateById(Role entity) {
		return super.updateById(entity);
	}
}
